/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.udt.generator.api.entityinterface;

import com.inspur.edp.caf.generator.baseInfo.ParameterInfo;
import com.inspur.edp.caf.generator.utils.ExpressionUtils;
import com.inspur.edp.cef.designtime.api.IGspCommonDataType;
import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.resourceInfo.ResourceInfoCtorGenerator;
import java.util.ArrayList;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.SuperConstructorInvocation;

public class UdtResourceInfoCtorGenerator extends ResourceInfoCtorGenerator {

  private IGspCommonDataType dataType;

  protected UdtResourceInfoCtorGenerator(String className,
      IGspCommonDataType dataType) {
    super(className, dataType);
    this.dataType = dataType;
  }

  protected final Block buildMethodBody() {
    Block block = this.ast.newBlock();
    SuperConstructorInvocation superConstructorInvocation = this.ast.newSuperConstructorInvocation();
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(this.ast, this.dataType.getCode()));
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(this.ast, this.dataType.getI18nResourceInfoPrefix().concat(".").concat("Name")));
//    superConstructorInvocation.arguments().add(this.ast.newSimpleName(this.paramName));
//    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(this.ast, this.dataType.getID()));
    block.statements().add(superConstructorInvocation);
    this.addExtendStatements(block);
    return block;
  }

  @Override
  protected ArrayList<ParameterInfo> getParameterCollection() {
    return null;
  }
}
